pro wcsalign

;edit the header of a fits file such that image location [crpix1,crpix2]
;corresponds to WCS location [crval1,crval2]

filen=dialog_pickfile(title='Select a FITS file for header correction',filter='*.fits')
print,filen

print,'WCSALIGN:  ** Warning -- This will modify your FITS header on disk! **'
read,'Enter two pixel values for CRPIX1 and CRPIX2: ',crp1,crp2
get_coords,coords,'Enter RA, Dec corresponding to CRPIX (Format: 00 00 00 +00 00 00)'
dra=coords[0]*15.
ddec=coords[1]

fxhmodify,filen,'CRPIX1',crp1
fxhmodify,filen,'CRPIX2',crp2
fxhmodify,filen,'CRVAL1',dra
fxhmodify,filen,'CRVAL2',ddec

print,'modification Done.'

end
